var express = require('express')
var serveStatic = require('serve-static')

var staticBasePath = './';
 
var app = express()

app.use(serveStatic(staticBasePath))

var https = require('https')
var fs = require('fs')
var selfsigned = require('selfsigned')
// HTTPS配置
var attrs = [{ name: 'commonName', value: 'localhost' }];
var pems = selfsigned.generate(attrs, { days: 365 });
var options = {
    key: pems.private,
    cert: pems.cert,
    minVersion: 'TLSv1.2',  // 最低TLS版本要求
    maxVersion: 'TLSv1.3',  // 最高TLS版本
    ciphers: [
        'ECDHE-RSA-AES128-GCM-SHA256',
        'ECDHE-RSA-AES256-GCM-SHA384'
    ].join(':'),
    honorCipherOrder: true  // 优先使用上面列表中靠前的加密套件
};

https.createServer(options, app).listen(8443)

console.log('Listening on port 8080');
